/*
 * @Author: 谢小康 2170673706@qq.com
 * @Date: 2024-01-13 15:33:26
 * @LastEditors: 谢小康 2170673706@qq.com
 * @LastEditTime: 2024-01-31 13:46:43
 * @FilePath: \My-bolg\My_Blog\src\api\friend.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "./index.js"
/* 添加朋友 */
const addfriend =async(data)=>{
    return new Promise((resolve, reject) => {
        http.post("/api/friend/addfriend",data).then(res=>{
            resolve(res)
        })
    })
}
/* 获取七牛云的token */
const getQiniuToken = ()=>{
    return new Promise((resolve,reject)=>{
        http.get("/api/user/getqiniutoken").then((res)=>{
            resolve(res)
        })
    })
}
/* 上传七牛云 */
const uploadtoqiniu =(formdata,config)=>{
    return new Promise((resolve,reject)=>{
        http.post("https://upload-z1.qiniup.com",formdata,config).then((res)=>{
            resolve(res)
        })
    })
}
const getfriends = (data) => {
    return new Promise((resolve, reject) => {
         http.get('/api/friend/getfriend',{params:data}).then(res => {
             resolve(res)
         })
     })
 }
export{
    addfriend,
    uploadtoqiniu,
    getQiniuToken,
    getfriends
}